<h3>Account Costumer</h3>
<div id="smallLeft"><h3>Data Costumer</h3>
    <table>
        <tr>
            <td></td>
            <td></td>
        </tr>

        <?php foreach ($rows as $booking): ?>
            <tr>
                <td>Username:</td>
                <td><?php echo get_user($booking->id_user) ?></td>
            </tr>    
            <tr>
                <td>Mskapai:</td>
                <td><?php echo $booking->airlines_name ?> <?php echo $booking->flight_number ?></td>
            </tr>    
            <tr>
                <td>Total Price:</td>
                <td><?php echo $booking->price_value ?></td>
            </tr>    
            <tr>
                <td>Fee:</td>
                <td><?php echo $booking->fee ?></td>
            </tr>    
            <tr>
                <td>Total:</td>
                <td><?php echo $booking->total ?></td>
            </tr>    
            <tr>
                <td>From:</td>
                <td><?php echo get_airport($booking->from) . " ($booking->from)" ?></td>
            </tr>    
            <tr>
                <td>To:</td>
                <td><?php echo get_airport($booking->to) . " ($booking->to)" ?></td>
            </tr>    
            <tr>
                <td>Depart:</td>
                <td><?php echo $booking->simple_departure_time ?> / <?php echo get_tanggal_1($booking->date) ?></td>
            </tr>    
            <tr>
                <td>Arrive:</td>
                <td><?php echo $booking->simple_arrival_time ?> / <?php echo get_tanggal_1($booking->date) ?></td>
            </tr>    
            <tr>
                <td>Class:</td>
                <td><?php echo $booking->class ?></td>
            </tr>    
            <tr>
                <td>Adult:</td>
                <td><?php echo $booking->adult ?></td>
            </tr>
            <tr>
                <td>Child:</td>
                <td><?php echo $booking->child ?></td>
            </tr>
            <tr>
                <td>Infant:</td>
                <td><?php echo $booking->infant ?></td>
            </tr>
            <tr>
                <td>File / Tiket:</td>
                <td><?php echo anchor('bookings/download/' . $booking->file, $booking->file . ' ') ?></td>
            </tr>
            <tr>
                <td>Keterangan:</td>
                <td><?php echo $booking->keterangan ?></td>
            </tr>
            <tr>
                <td>Status:</td>
                <td><?php echo get_status_color($booking->status) ?></td>
            </tr>

        <?php endforeach; ?>
    </table>

</div>

<div id="smallRight"><h3>Detail penumpang</h3>
    <table>
        <tr>
            <td></td>
            <td></td>
        </tr>

        <?php $adults = get_booking_adult($booking->code) ?>
        <?php $no = 1 ?>
        <?php foreach ($adults as $adult): ?>


            <tr><td>
                    <b>Dewasa <?php if (count($adults) > 1) { ?><?php echo $no ?><?php } ?></b>
                </td></tr>
            <tr>
                <td>Nama Depan:</td>
                <td><?php echo $adult->title_adult ?> <?php echo $adult->nama_depan ?> </td>
            </tr>
            <tr>
                <td>Nama Belakang:</td>
                <td><?php echo $adult->nama_belakang ?></td>
            </tr>
            <tr>
                <td>Passport:</td>
                <td><?php echo $adult->passport ?></td>
            </tr>
            <tr>
                <td>Identitas:</td>
                <td><?php echo $adult->identitas ?></td>
            </tr>
            <?php $no++ ?>
        <?php endforeach; ?>

        <?php if ($booking->child > 0): ?>
            <?php $childs = get_booking_child($booking->code) ?>
            <?php $no = 1 ?>
            <?php foreach ($childs as $child): ?>
                <tr><td><b>Anak <?php if (count($childs) > 1) { ?><?php echo $no ?><?php } ?></b></td></tr>
                <tr>
                    <td>Nama Depan:</td>
                    <td><?php echo $child->title ?> <?php echo $child->nama_depan ?> </td>
                </tr>
                <tr>
                    <td>Nama Belakang:</td>
                    <td><?php echo $child->nama_belakang ?></td>
                </tr>
                <tr>
                    <td>Tanggal Lahir:</td>
                    <td><?php echo $child->tanggal . "-" . $child->bulan . "-" . $child->tahun ?></td>
                </tr>
                <?php $no++ ?>
            <?php endforeach; ?>
        <?php endif ?>

        <?php if ($booking->infant > 0): ?>
            <?php $infants = get_booking_infant($booking->code) ?>
            <?php $no = 1 ?>
            <?php foreach ($infants as $infant): ?>
                <tr><td><b>Bayi <?php if (count($infants) > 1) { ?><?php echo $no ?><?php } ?></b></td></tr>
                <tr>
                    <td>Nama Depan:</td>
                    <td><?php echo $infant->title ?> <?php echo $infant->nama_depan ?> </td>
                </tr>
                <tr>
                    <td>Nama Belakang:</td>
                    <td><?php echo $infant->nama_belakang ?></td>
                </tr>
                <tr>
                    <td>Tanggal Lahir:</td>
                    <td><?php echo $infant->tanggal . "-" . get_month($infant->bulan) . "-" . $infant->tahun ?></td>
                </tr>
                <tr>
                    <td>Orang Tua:</td>
                    <td><?php echo get_orangtua($infant->orangtua) ?></td>
                </tr>
                <?php $no++ ?>
            <?php endforeach; ?>
        <?php endif ?>

    </table>

</div>

<div id="smallRight"><h3>Data Kontak</h3>
    <table>
        <tr>
            <td></td>
            <td></td>
        </tr>

        <?php foreach ($rows as $booking): ?>

            <tr>
                <td>Title Name:</td>
                <td><?php echo $booking->title_dk ?> <?php echo $booking->nama_d_dk ?></td>
            </tr>
            <tr>
                <td>Last Name:</td>
                <td><?php echo $booking->nama_b_dk ?></td>
            </tr>
            <tr>
                <td>Kode Negara:</td>
                <td><?php echo $booking->kode_negara_dk ?></td>
            </tr>
            <tr>
                <td>No telephone:</td>
                <td><?php echo $booking->nomor_telp_dk ?></td>
            </tr>
            <tr>
                <td>Kode Negara:</td>
                <td><?php echo $booking->kode_negara_s_dk ?></td>
            </tr>
            <tr>
                <td>No Telephone Selular:</td>
                <td><?php echo $booking->no_telp_selular_dk ?></td>
            </tr>
            <tr>
                <td>Catatan:</td>
                <td><?php echo $booking->catatan_dk ?></td>
            </tr>
            <tr>
                <td>Booking Time:</td>
                <td><?php echo $booking->date_create ?></td>
            </tr>
            <tr>
                <td>Code Booking:</td>
                <td><?php echo $booking->code_booking ?> </td>
            </tr>

        <?php endforeach; ?>
    </table>
</div>
<?php foreach ($access->result() as $a): ?>
    <?php if ($a->booking_m_confirm > 0): ?>
        <?php if ($booking->status == 2): ?>
            <div id="smallLeft">
                <!--<form name="myForm" action="<?php echo base_url() ?>bookings/code_booking" onsubmit="return validateForm()" method="post">-->
                <?php echo form_open_multipart('bookings/code_booking') ?>
                <table>
                    <?php echo form_hidden('fee', $booking->fee) ?>
                    <?php echo form_hidden('code_booking', $booking->code_booking) ?>
                    <td>Document / File / Tiket</td>
                    <td>
                        <input type="file" name="userfile" id="userfile"/>
                    </td>
                    <?php echo form_hidden('id_booking', $booking->id) ?>
                    <?php echo form_hidden('price', $booking->price_value) ?>
                    <?php echo form_hidden('id_user', $booking->id_user) ?>
                    <?php echo form_hidden('code', $booking->code) ?>
                    <tr><td><?php echo form_submit('submit', 'Confirm') ?></td></tr>
                </table>
                <?php echo form_close() ?>
                <!--        </form>-->
            </div>
        <?php endif ?>
    <?php endif ?>
    <p>

        <?php if ($a->booking_m_confirm > 0): ?>
            <?php // echo anchor('bookings/edit_code/' . $booking->id . '.-.' . $booking->id_user . '.-.' . $booking->code_booking . '.-.' . $booking->file . '.-.' . $booking->fee . '.-.' . $booking->price_value, 'Edit') ?> |<?php // endif ?> <?php // echo anchor('bookings/index', 'Back') ?>
            <?php echo anchor('bookings/edit_code/' . $booking->id, 'Edit') ?> |<?php endif ?> <?php echo anchor('bookings/index', 'Back') ?>

    </p>
<?php endforeach ?>


<script>
    function validateForm()
    {
        var x=document.forms["myForm"]["code_booking"].value;
        if (x==null || x=="")
        {
            alert("Kode Booking harus di isi");
            return false;
        }
    }
</script>